<?php
namespace app\index\model;
use \think\Model;
use \think\Db;
class LoginModel{
	public function login($user_no)
	{
		$data = Db::table('user')->where('status',1)->where('user_no',$user_no)->find();
        return $data;
	}

	public function register($insert_data, $create_time='0')
	{
		if($create_time){
			$insert_data['create_time'] = date("Y-m-d H:i:s");
		}
		$id = Db::name('user')->insertGetId($insert_data);
		return $id;
	}

	public function valid_user_no($user_no)
	{
		$data = Db::table('user')->where('status',1)->where('user_no',$user_no)->find();
        return $data;
	}

	public static function get_user_info($user_no)
	{
		$data = Db::table('user')->where('status',1)->where('user_no',$user_no)->find();
        return $data;
	}

	public function update_last_login_time($user_no)
	{
		Db::table('user')->where('user_no',$user_no)->setField('last_login_time',date("Y-m-d H:i:s"));
	}

}